<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="referrer" content="no-referrer" />
    <title>淹没分析</title>
    <style>
        body {
            position: absolute;
            margin: 0;
            width: 100%;
            height: 100%;
        }

        #mapContainer {
            left: 0px;
            top: 0px;
            width: 100%;
            height: 100%;
            float: left;
        }
    </style>
</head>

<body>
    <div id="mapContainer" style="position: relative;"></div>
</body>
<script src='/GiswayEngine.js'></script>
<script type="text/javascript">
    window.app = new GE.App('mapContainer', {
        // position: [113.5538908662442, 37.83083498976058,800],
        // lookAt: [113.5538908662442, 37.83083498976058, 0],

        position: [113.5713975985057, 37.83543270206034,800],
        lookAt: [113.5713975985057, 37.83543270206034, 0],
        // position: [12.724637,23.201823,800],
        // lookAt: [12.724637,23.201823, 0],
        cameraScrollSpeed: 5,
        minZoom: 3,
        maxZoom: 18,
        ambientLightIntensity: 5,
        useDefaultTexture: true, //是否使用瓦片默认纹理     
        polygonPointNumInShader: 25, //多边形的最大顶点数量, 该属性只在压平分析，淹没分析，压平分析中使用，如果不使用这三个分析功能不要设置该属性，否则会对性能有影响
        maxSlopeAngle: 50, //地图最大倾斜角度
        baseLayer: [
            {
                //url: 'http://115.236.87.26:8848/googleTiles/china_image/{z}/{y}/{x}.jpg',
                url: ' https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
                urlDecimal: true,
                // demUrl:'http://192.168.2.100:8702/demres/sxtt/dem/SXDEM_ImageServer/_alllayers/{z}/{y}/{x}.lerc',
                demUrl:'http://localhost:9000/examples/resources/dem/dem/SXDEM_ImageServer/_alllayers/{z}/{y}/{x}.lerc',
                demUrlDecimal: false,
                demHeightAdjust:800, 
                // tileType: 'image',
                tileType: 'dem',
                canNotSelect: true, //true表示该图层不参与射线拾取，false表示图层参与射线拾取
            },
        ]
    });
    
    var bloomShape = [
        new GE.Point(113.51467888565323, 37.852959765389144, 0, '4326'),
        new GE.Point(113.53528514277666, 37.81418857876654, 0, '4326'),
        new GE.Point(113.56890444567925, 37.81417658619176, 0, '4326'),
        new GE.Point(113.59004807543256, 37.85374395377242, 0, '4326')
    ];
    let zoomRange = {minZoom: 16, maxZoom: 18};
    var bloomAnalysis = new GE.BloomAnalysis({bloomShape: bloomShape, zoomRange: zoomRange});
       

    window.app.on('Click', function (e) {
        console.log(e);
    });

    btn();

    function btn() {
        let button1 = new GE.Button('打开淹没分析', function () {
            bloomAnalysis.openAnalysis(600, 0.1);
        });
        app.ui.add(button1);

        let button2 = new GE.Button('关闭淹没分析', function () {
            bloomAnalysis.closeAnalysis();
        });
        app.ui.add(button2);
    }



</script>

</html>